package p270jp.pxv.android.view;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.util.AttributeSet;
import android.view.View;
import java.util.Objects;
import p018ai.C0218e;
import p270jp.pxv.android.R;
import p274k2.ContextCompat;

/* renamed from: jp.pxv.android.view.TriangleView */
/* loaded from: classes2.dex */
public class TriangleView extends View {

    /* renamed from: a */
    public String f19700a;

    /* renamed from: b */
    public int f19701b;

    public TriangleView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet, 0);
        this.f19700a = "right";
        TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, C0218e.f752j);
        this.f19700a = obtainStyledAttributes.getString(0);
        Context context2 = getContext();
        Object obj = ContextCompat.f19963a;
        this.f19701b = obtainStyledAttributes.getColor(1, ContextCompat.C4473d.m4257a(context2, R.color.charcoal_white));
        obtainStyledAttributes.recycle();
    }

    @Override // android.view.View
    public void draw(Canvas canvas) {
        super.draw(canvas);
        Paint paint = new Paint();
        paint.setColor(this.f19701b);
        paint.setStyle(Paint.Style.FILL);
        int width = getWidth();
        int height = getHeight();
        Path path = new Path();
        String str = this.f19700a;
        Objects.requireNonNull(str);
        char c = 65535;
        switch (str.hashCode()) {
            case -1383228885:
                if (str.equals("bottom")) {
                    c = 0;
                    break;
                }
                break;
            case 115029:
                if (str.equals("top")) {
                    c = 1;
                    break;
                }
                break;
            case 3317767:
                if (str.equals("left")) {
                    c = 2;
                    break;
                }
                break;
            case 108511772:
                if (str.equals("right")) {
                    c = 3;
                    break;
                }
                break;
        }
        switch (c) {
            case 0:
                path.moveTo(0.0f, 0.0f);
                path.lineTo((float) (width / 2), (float) height);
                path.lineTo((float) width, 0.0f);
                break;
            case 1:
                float f = (float) height;
                path.moveTo(0.0f, f);
                path.lineTo((float) (width / 2), 0.0f);
                path.lineTo((float) width, f);
                break;
            case 2:
                float f2 = (float) width;
                path.moveTo(f2, 0.0f);
                path.lineTo(0.0f, (float) (height / 2));
                path.lineTo(f2, (float) height);
                break;
            case 3:
                path.moveTo(0.0f, 0.0f);
                path.lineTo((float) width, (float) (height / 2));
                path.lineTo(0.0f, (float) height);
                break;
        }
        path.close();
        canvas.drawPath(path, paint);
    }
}
